from typing import Union
from .models import StructValue
from ..universal_ast_nodes import *


class ExecutorTypesManager:
    def __init__(self, types_asts: Dict[str, Union[StructDecl, Type]]) -> None:
        self._types_uasts = {}

    def create_struct_value_by_decl(struct_decl: StructDecl) -> StructValue:
        return StructValue(
            {
                member.name: create_concreate_value_by_type(member.type)
                for member in struct_decl.members
            }
        )

    def create_concreate_value_by_type(type: DATA_TYPE) -> ConcreteValueType:
        match type:
            case IntType():
                return 0
            case FloatType():
                return 0.0
            case StructType():
                raise NotImplementedError
            case _:
                raise NotImplementedError(f"Type {type} is not implemented")
